package org.redemptionhost.web.panels;

import java.util.List;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.redemptionhost.HostQueries;
import org.redemptionhost.Repository;
import org.redemptionhost.model.Host;

import com.google.inject.Inject;

public class HostEmailPanel extends Panel {
	@Inject
    public Repository<Host> hostRepository;

    @Inject
    private HostQueries hostQueries;
     
    private List<Host> fullHostList;
     
 	public HostEmailPanel(String id) {
		super(id);
		
    	StringBuilder emailString = new StringBuilder();
    	
    	fullHostList = hostQueries.all();
    	for (Host host : fullHostList) {
    		emailString.append(host.getEmail() + ";");
    	}

    	add(new Label("emailLabel", emailString.toString().substring(0, emailString.length()-1)));
	}

}
